/* ============================================
   AMI - Chat Components & Visualization Panels
   ============================================ */

/* --- Message Bubbles --- */
.message {
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 10px;
    max-width: 85%;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message.user-message {
    background: #3b82f6;
    color: white;
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.message.system-message {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.message.system-message.thought {
    color: #90EE90;
    font-family: var(--font-mono);
    font-size: 12px;
    border-left: 2px solid #90EE90;
    background: rgba(144, 238, 144, 0.05);
}

.message.system-message.sql {
    color: #f1fa8c;
    font-family: monospace;
    background: rgba(0, 0, 0, 0.2);
}

.message.system-message.answer {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 500;
    border-left: 2px solid white;
}

/* --- Log Entries --- */
.log-entry {
    margin-bottom: var(--spacing-sm);
    line-height: 1.4;
    word-wrap: break-word;
    opacity: 0;
    animation: fadeIn 0.1s forwards;
    border-left: 2px solid transparent;
    padding-left: 8px;
}

.log-entry.log-type-thought {
    color: #90EE90;
    font-style: italic;
    border-left-color: #90EE90;
}

.log-entry.log-type-sql {
    color: #f1fa8c;
    background: rgba(255, 255, 0, 0.05);
    padding: 8px;
    border-radius: 4px;
    font-family: monospace;
    white-space: pre-wrap;
    border-left-color: #f1fa8c;
}

.log-entry.log-type-log {
    color: #8be9fd;
}

.log-entry.log-type-answer {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px;
    border-radius: 4px;
    margin-top: 10px;
    border-left-color: white;
}

.log-entry.log-type-error {
    color: #ff5555;
    border-left-color: #ff5555;
}

.log-entry.log-type-debug {
    color: #6272a4;
    font-size: 11px;
    border: none;
    padding-left: 0;
    margin-bottom: 4px;
    font-family: 'JetBrains Mono', monospace;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* --- Visualization Panels --- */
.viz-panel {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    margin: 50px 10px 10px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    height: 100%;
}

.panel-header {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-size: 14px;
    color: var(--hex-accent);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.panel-tabs {
    display: flex;
    gap: 2px;
}

.panel-tab {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 11px;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-family: var(--font-mono);
    transition: all 0.2s;
}

.panel-tab:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.panel-tab.active {
    color: var(--hex-accent);
    background: rgba(59, 130, 246, 0.1);
}

.viz-content {
    flex: 1;
    position: relative;
    padding: 0px;
    overflow: auto;
    height: 100%;
}

.viz-content::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.viz-content::-webkit-scrollbar-track {
    background: #0f172a;
    border-radius: 4px;
}

.viz-content::-webkit-scrollbar-thumb {
    background: #475569;
    border: 2px solid #0f172a;
    border-radius: 6px;
}

.viz-view.hidden {
    display: none;
}

.code-view {
    width: 100%;
    height: 100%;
    overflow: auto;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #e2e8f0;
    white-space: pre-wrap;
}

.code-view.json {
    color: #a5d6ff;
}

.code-view.sql {
    color: #f1fa8c;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.no-viz-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-lighter);
    font-size: 14px;
    flex-direction: column;
    gap: 10px;
}

.no-viz-placeholder .icon {
    font-size: 32px;
    opacity: 0.3;
}

/* --- Bottom Interaction Components --- */
.control-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.control-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.hex-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--hex-text);
    padding: 6px 12px;
    border-radius: 4px;
    font-family: var(--font-sans);
    font-size: 12px;
}

.hex-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hex-btn-xs {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-lighter);
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 10px;
    font-family: var(--font-mono);
    margin-right: 8px;
    transition: all 0.2s;
}

.hex-btn-xs:hover {
    border-color: var(--hex-accent);
    color: var(--hex-accent);
    background: rgba(59, 130, 246, 0.1);
}

.hex-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.hex-btn.active {
    background: var(--hex-accent);
    color: white;
    border-color: var(--hex-accent);
    box-shadow: 0 0 10px var(--hex-accent-glow);
}

.chips-bar {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    margin-top: 10px;
}

.chips-bar::-webkit-scrollbar {
    height: 4px;
}

.chips-bar::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 2px;
}

.text-xs {
    font-size: 11px;
    color: var(--text-lighter);
}